<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>博客后台管理系统</title>
    <link rel="stylesheet" type="text/css" href="/static/admin/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="/static/admin/css/style.css">
    <link rel="stylesheet" type="text/css" href="/static/admin/css/font-awesome.min.css">
    <link rel="apple-touch-icon-precomposed" href="/static/admin/images/icon/icon.png">
    <script src="/static/admin/js/jquery-2.1.4.min.js"></script>
    <!--[if gte IE 9]>
    <script src="/static/admin/js/jquery-1.11.1.min.js" type="text/javascript"></script>
    <script src="/static/admin/js/html5shiv.min.js" type="text/javascript"></script>
    <script src="/static/admin/js/respond.min.js" type="text/javascript"></script>
    <script src="/static/admin/js/selectivizr-min.js" type="text/javascript"></script>
    <![endif]-->
    <!--[if lt IE 9]>
    <script>window.location.href = 'upgrade-browser.html';</script>
    <![endif]-->
</head>

<body class="user-select">
<section class="container-fluid">
    <header>
        <nav class="navbar navbar-default navbar-fixed-top">
            <div class="container-fluid">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed"
                            data-toggle="collapse"
                            data-target="#bs-example-navbar-collapse-1"
                            aria-expanded="false">
                        <span class="sr-only"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="#">WDSS</a>
                </div>
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                    <ul class="nav navbar-nav navbar-right">

                        {# 如果用户登录了就显示用户名，如果没有登录就显示登录按钮 #}
                        {% if username %}
                            <li>
                            <a href = "" >欢迎您： {{ username }}</a >
                            </li>
                            <li><a href="/admin/logout">退出登录</a></li>
                        {% else %}
                            <li><a href="/admin/login">登录</a></li>
                        {% endif %}

                        <li><a data-toggle="modal" data-target="#WeChat"> </a></li>
                    </ul>

                </div>
            </div>
        </nav>
    </header>
    <div class="row">
        <aside class="col-sm-3 col-md-2 col-lg-2 sidebar">
            <ul class="nav nav-sidebar">
                <li><a href="/admin/index/">总览</a></li>
            </ul>
            <ul class="nav nav-sidebar">
                <li><a href="/admin/category/">分类管理</a></li>
            </ul>
            <ul class="nav nav-sidebar">
                <li class="active"><a href="/admin/article/">文章管理</a></li>
            </ul>
            <ul class="nav nav-sidebar">
                <li><a href="/admin/article/">相册管理</a></li>
            </ul>
        </aside>

        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-lg-10 col-md-offset-2 main" id="main">
            <div class="row">
                <form action="/admin/addarticle/" method="post" class="add-article-form"
                      enctype="multipart/form-data">
                    <div class="col-md-9">
                        <h1 class="page-header">添加文章</h1>

                        <div class="add-article-box">
                            <h2 class="add-article-box-title"><span>文章标题</span></h2>
                            <div class="add-article-box-content">
                                <input type="text" class="form-control" placeholder="在此处输入标题" name="name"
                                       autocomplete="off">
                            </div>
                        </div>

                        <div class="add-article-box">
                            <h2 class="add-article-box-title"><span>关键字</span></h2>
                            <div class="add-article-box-content">
                                <input type="text" class="form-control" placeholder="请输入关键字" name="keywords"
                                       autocomplete="off">
                                <span class="prompt-text">多个标签请用英文逗号,隔开。</span>
                            </div>
                        </div>

                        <div class="add-article-box">
                            <h2 class="add-article-box-title"><span>文章内容</span></h2>
                            <div class="add-article-box-content">
                                <textarea cols="5" class="form-control" name="content" autocomplete="off"></textarea>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <h1 class="page-header">操作</h1>
                        <div class="add-article-box">
                            <h2 class="add-article-box-title"><span>选择分类</span></h2>
                            <div class="add-article-box-content">
                                <ul class="category-list">

                                    {% for category in categorys %}
                                        <li>
                                        <label>
                                            <input name="category" value="{{ category.id }}" type="radio" checked>
                                            {{ category.name }}
                                        </label>
                                    </li>
                                    {% endfor %}


                                </ul>
                            </div>
                        </div>

                        <div class="add-article-box">
                            <h2 class="add-article-box-title"><span>文章标题图片</span></h2>
                            <div class="add-article-box-content">
                                <input type="file" name="img" id="file">
                            </div>
                            <div class="add-article-box-footer">
                                <img id="myimg" src="" alt="" width="130" height="100">
                            </div>
                        </div>
                        <div class="add-article-box">
                            <div class="add-article-box-footer">
                                <button style="width: 100%" class="btn btn-primary" type="submit" name="submit">发布</button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</section>

<script src="/static/admin/js/bootstrap.min.js"></script>
<script src="/static/admin/js/admin-scripts.js"></script>
<script src="lib/ueditor/ueditor.config.js"></script>
<script src="lib/ueditor/ueditor.all.min.js"></script>
<script src="lib/ueditor/lang/zh-cn/zh-cn.js"></script>

<script>
    // 选择图片后 显示
    $("#file").change(function(){
        $("#myimg").attr("src",URL.createObjectURL($(this)[0].files[0]));
    });

</script>

</body>
</html>
